﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;

namespace _0712502_0712504_DesignPatternGame
{
    /// <summary>
    /// Lớp ảo thông tin một Object cơ bản
    /// </summary>
    public abstract class VisibleGameObject
    {
        protected Vector2 _position;
        public Vector2 Position
        {
            get { return _position; }
            set 
            { 
                _position = value;

                _rectCollisionInside.X = (int)_position.X -_sizeOfRectInside.X / 2;
                _rectCollisionInside.Y = (int)_position.Y -_sizeOfRectInside.Y / 2;
                _rectCollisionInside.Width = _sizeOfRectInside.X;
                _rectCollisionInside.Height = _sizeOfRectInside.Y;

                _rectCollisionOutside.X = (int)_position.X -_sizeOfRectOutside.X / 2;
                _rectCollisionOutside.Y = (int)_position.Y -_sizeOfRectOutside.Y / 2;
                _rectCollisionOutside.Width = _sizeOfRectInside.X;
                _rectCollisionOutside.Height = _sizeOfRectInside.Y;               
            }
        }

        protected float _rotationAngle;   // goc ve anh
        public float RotationAngle
        {
            get { return _rotationAngle; }
            set { _rotationAngle = value; }
        }

        protected Rectangle _size;
        public Rectangle Size
        {
            get 
            { 
                return _size; 
            }
            set
            {
                _size = value;
                _origin = new Vector2(_size.Width / 2, _size.Height / 2);
            }
        }

        protected Vector2 _origin;
        public Vector2 Origin
        {
            get { return _origin; }
            set { _origin = value; }
        }

        protected Rectangle _rectCollisionInside;   // Hình chữ nhật va chạm bên trong
        public Rectangle RectCollisionInside
        {
            get { return _rectCollisionInside; }
            set { _rectCollisionInside = value;}
        }

        Rectangle _rectCollisionOutside;   // Hình chữ nhật va chạm bên ngoài
        public Rectangle RectCollisionOutside
        {
            get { return _rectCollisionOutside; }
            set { _rectCollisionOutside = value; }
        }

        protected Point _sizeOfRectInside;
        public Point SizeOfRectInside
        {
            get { return _sizeOfRectInside; }
            set 
            { 
                _sizeOfRectInside = value;
                _rectCollisionInside.Width = _sizeOfRectInside.X;
                _rectCollisionInside.Height = _sizeOfRectInside.Y;
            }
        }

        protected Point _sizeOfRectOutside;
        public Point SizeOfRectOutside
        {
            get { return _sizeOfRectOutside; }
            set 
            { 
                _sizeOfRectOutside = value;
                _rectCollisionOutside.Width = _sizeOfRectOutside.X;
                _rectCollisionOutside.Width = _sizeOfRectOutside.Y;
            }
        }

        protected Color _filterColor;

        public Color FilterColor
        {
            get { return _filterColor; }
            set { _filterColor = value; }
        }
       

        public virtual void DrawToScreen(GameTime gameTime, SpriteBatch spriteBatch)
        {
        }       
    }
}
